// -----------------------------------------------------------------------------
// DM 是 .NET 5 平台下开发管理的系统。
// Copyright © 2021 DM, 虫儿飞科技 Co.,Ltd.
//
// 框架名称：Furion
// 框架版本：1.0.0
// -----------------------------------------------------------------------------

using System.ComponentModel.DataAnnotations;

namespace Abc.Application.HtAdmin.Dto
{
    public class AdminLoginDto
    {
        ///<Summary>
        /// UserName
        ///</Summary>
        //[Required(ErrorMessage = "账号不能为空"), MinLength(4, ErrorMessage = "账号长度不能小于4位"), MaxLength(15, ErrorMessage = "账号长度不能超过15")]
        [RegularExpression("[a-zA-Z0-9_@]{4,20}", ErrorMessage = "账号长度为4~15,且只能是数字大小写字母、下划线、@")]   // 正则表达式验证
        public string Account { get; set; }

        ///<Summary>
        /// PassWord
        ///</Summary>
        //[Required]    // 必填验证
        //[RegularExpression("[a-zA-Z0-9~!@#$%^&*()_+.]{6,20}", ErrorMessage = "密码长度在6~20，且只能是数字、英文大小写、以及这些字符：~!@#$%^&*()_+.")]    // 正则表达式验证
        [MinLength(6, ErrorMessage = "密码长度为6~20长度的字符"), MaxLength(20, ErrorMessage = "密码长度为6~20长度的字符")]
        public string PassWord { get; set; }

        //public string RePassWord { get; set; }

        //protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        //{
        //    var movie = (Movie)validationContext.ObjectInstance;
        //    var releaseYear = ((DateTimeOffset)value).Year;

        //    if (movie.Genre == Genre.Classic && releaseYear > Year)
        //    {
        //        return new ValidationResult(GetErrorMessage());
        //    }

        //    return ValidationResult.Success;
        //}
    }
}